import {get_dic_data} from "@/api/dic/data";

export const globalStore = {
    state: {
        loading: false,
        //    开启全屏
        full_screen: false,
        //    字典类型的缓存
        type_data_list: [],
        //    设备编号的缓存
        uEquipmentCode: ""
    },
    mutations: {
        SET_LOADING: (state, loading) => {
            state.loading = loading
        },
        SET_SCREEN: (state, full_screen) => {
            state.full_screen = full_screen
        },
        SET_TYPE_DATA_LIST: (state, type_data_list) => {
            state.type_data_list = type_data_list
        },
        SET_DEVICE_CODE: (state, uEquipmentCode) => {
            state.uEquipmentCode = uEquipmentCode
        },

    },
    actions: {
        get_data_by_code() {
            const request_dic_data = async (code) => {
                let params = {
                    dictCode: code
                }
                const res = await get_dic_data(params)
                if (res.code === 1) {
                    return res.data
                }
                return [];
            }
            let data = request_dic_data()
        }
    }
}
